#!/bin/sh
#
# This script will be executed *after* all the other init scripts.
# You can put your own initialization stuff in here if you don't
# want to do the full Sys V style init stuff.

# Ensure we delete the vagrant user if it exists
userdel vagrant

cat /etc/redhat-release > /etc/issue
echo "Kernel \r on an \m" >> /etc/issue
echo "" >> /etc/issue
echo "Welcome to the PacketFence-ZEN." >> /etc/issue
echo "" >> /etc/issue
echo "In order to configure your PacketFence installation, please connect to one of the following URLs:" >> /etc/issue
mgmt_ipaddr=`/usr/local/pf/bin/pfcmd pfconfig show interfaces::management_network | grep Tip | egrep -o '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}'`
if [ "$mgmt_ipaddr" != "" ]; then
	echo https://$mgmt_ipaddr:1443 >> /etc/issue
else
	for IPADDR in `/sbin/ifconfig | sed '/broadcast/!d' | awk '{print $2}'`; do
		echo "https://$IPADDR:1443" >> /etc/issue
	done
fi
echo "" >> /etc/issue
echo "" >> /etc/issue


touch /var/lock/subsys/local
